home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / obsolete / widedit.pro < prev    next >
Encoding:
Text File  |  1997-07-08  |  33.7 KB  |  1,039 lines

  1. ;
  2. ; $Id: widedit.pro,v 1.10 1997/01/15 03:11:50 ali Exp $
  3. ;
  4. ;  WidEdit
  5. ;   Cut/Paste/Copy/Edit dialog routines.
  6. ;   These are the other 'Top Level' dialogs and as main, have many
  7. ;   externally visible hooks (c.f. wided.com)
  8. ;
  9. ; Copyright (c) 1993-1997, Research Systems, Inc.  All rights reserved.
  10. ;   Unauthorized reproduction prohibited.
  11. ;
  12. ; MODIFICATION HISTORY
  13. ;       Written by:     Joshua Goldstein,       12/93
  14. ;
  15. ;
  16.  
  17.  
  18. ;
  19. ;  UpdateCut
  20. ;   Update the given dialog box (cut, copy or edit) to reflect a
  21. ;   change in the current widget tree.
  22. ;
  23. ;   General notes:
  24. ;
  25. ;   If we are looking at some portion of the widget tree and any portion
  26. ;   of that tree has been removed, give up and look at the top level.
  27. ;
  28. ;   If the widget tree is empty (widget tree consists of MAIN alone)
  29. ;   then close the dialog (nothing to cut copy or edit)
  30. ;
  31. PRO UpdateCut, Id, Removed
  32.  
  33.   COMMON WidEd_Comm
  34.  
  35.     WIDGET_CONTROL, Id, GET_UVALUE=Binfo, /NO_COPY      ; Get dialog info
  36.  
  37.     OldList         = Binfo.Ptrs                        ; Get list aux info
  38.  
  39.     ;   See if someone has removed any of base objects in our parenting
  40.     TreeDisturbed   = WHERE(Binfo.Parents EQ Removed, Count)
  41.     IF Count NE 0 THEN BEGIN
  42.     Again:
  43.         Binfo.Parents   = TopPtr            ; Make top base current parent
  44.         NewTop          = TopPtr
  45.     ENDIF ELSE BEGIN
  46.         NewTop          = Binfo.Parents     ; Use current parent
  47.         NewTop          = NewTop[0]
  48.     ENDELSE
  49.  
  50.     MakeLists, NewTop, List, Strs   ; Make list to reflect (possibly)
  51.                                     ; new current parent
  52.  
  53.     ;   No items in list?
  54.     IF List[0] EQ 0 THEN BEGIN
  55.  
  56.         ;   If we aren't looking at the top level base there still might
  57.         ;   be something to look at anyway.  Look at the root of the tree
  58.         ;   and try again.
  59.         IF NewTop NE TopPtr THEN GOTO, Again
  60.  
  61.         WIDGET_CONTROL, Id, /DESTROY        ; Nothing.
  62.  
  63.         ;   Clear the appropriate common block id to show that this
  64.         ;   dialog is no longer being shown
  65.  
  66.         IF Id EQ CutId THEN CutId = 0
  67.         IF Id EQ CopyId THEN CopyId = 0
  68.         IF Id EQ EditId THEN EditId = 0
  69.         RETURN
  70.     ENDIF
  71.  
  72.     ;   If the list has not been disturbed then leave it as it is.
  73.  
  74.     IF N_ELEMENTS(OldList) EQ N_ELEMENTS(List) THEN BEGIN
  75.         Dummy   = WHERE(OldList NE List, Count)
  76.  
  77.         ;   If the list has not been disturbed, see if the current
  78.         ;   selection is a base object and has had children added
  79.         ;   or removed from it.  Update the ability to look at its
  80.         ;   children accordingly.
  81.  
  82.         IF Count EQ 0 THEN BEGIN
  83.             WIDGET_CONTROL, Binfo.ChildBtn, $
  84.                 SENSITIVE=HasChildren(List[Binfo.ListIdx])
  85.             WIDGET_CONTROL, Id, SET_UVALUE=Binfo, /NO_COPY
  86.             RETURN
  87.         ENDIF
  88.     ENDIF
  89.  
  90.     ;   The list has been altered.  Update it to reflect the new changes.
  91.  
  92.     ;   Redeclare the dialog information.  Because List is an array
  93.     ;   and in all likelyhood is a different size than the original
  94.     ;   Binfo.Ptrs we can't just use:  Binfo.Ptrs   = list
  95.  
  96.  
  97.     Binfo   = {                     $
  98.         Ptrs:List,                  $
  99.         Parents:Binfo.Parents,      $
  100.         LabelId:Binfo.LabelId,      $
  101.         ListId:Binfo.ListId,        $
  102.         ListIdx:0,                  $
  103.         ActionBtn:Binfo.ActionBtn,  $
  104.         PasteBtn:Binfo.PasteBtn,    $
  105.         ChildBtn:Binfo.ChildBtn,    $
  106.         ParentBtn:Binfo.ParentBtn   $
  107.     }
  108.  
  109.     ;   Can't cut or copy DEP objects. Set cut/copy action button accordingly
  110.     Child   = List[0]
  111.     IF Id EQ CutId OR Id EQ CopyId THEN BEGIN
  112.         GetType, Child, Type
  113.         WIDGET_CONTROL, Binfo.ActionBtn, SENSITIVE=(Type NE "DEP")
  114.     ENDIF
  115.  
  116.     ;   Set labels and controls to reflect our new list
  117.  
  118.     WIDGET_CONTROL, Binfo.LabelId, SET_VALUE='Children of '+VarId(NewTop)
  119.     WIDGET_CONTROL, Binfo.ListId, SET_VALUE=Strs
  120.     WIDGET_CONTROL, Binfo.ListId, SET_LIST_SELECT=0
  121.     WIDGET_CONTROL, Binfo.ChildBtn, SENSITIVE=HasChildren(Child)
  122.     WIDGET_CONTROL, Binfo.ParentBtn, SENSITIVE=(NewTop NE TopPtr)
  123.  
  124.     ;   Restore dialog information
  125.     WIDGET_CONTROL, Id, SET_UVALUE=Binfo, /NO_COPY
  126. END
  127.  
  128.  
  129. ;
  130. ;  UpdateEdit
  131. ;   Entry point to updating all of the cut/copy/paste/edit dialogs
  132. ;   to reflect a change in the widget tree.
  133. ;
  134. PRO UpdateEdit, Removed
  135.  
  136.   COMMON WidEd_Comm
  137.  
  138.     ;   Get MAIN Base and dialog information
  139.  
  140.     Ptr2Obj, TopDlg, DlgInfo        ; So its not really a pointer
  141.     Ptr2Obj, TopPtr, TopObj
  142.  
  143.     ;   Set the sensitivity of the main EDIT pulldown menu
  144.     Sens    = ((TopObj.Children NE 0) OR (TopObj.Next NE 0))
  145.  
  146.     ;   Cut/copy/edit requires child widgets to be acted on
  147.  
  148.     WIDGET_CONTROL, DlgInfo.CutId, SENSITIVE=Sens
  149.     WIDGET_CONTROL, DlgInfo.CopyId, SENSITIVE=Sens
  150.     WIDGET_CONTROL, DlgInfo.EditId, SENSITIVE=Sens
  151.  
  152.     ;   Pasting requires that there be something to paste
  153.     Sens    = (CutList NE 0L)
  154.     WIDGET_CONTROL, DlgInfo.PasteId, SENSITIVE=Sens
  155.  
  156.     Obj2Ptr, TopObj, TopPtr     ; Restore info to top pointer
  157.     Obj2Ptr, DlgInfo, TopDlg    ; Restore info to top dialog
  158.  
  159.     IF N_ELEMENTS(Removed) EQ 0 THEN Removed = 0L
  160.  
  161.     ;   Update dialogs
  162.  
  163.     IF CutId NE 0 THEN UpdateCut, CutId, Removed
  164.     IF CopyId NE 0 THEN UpdateCut, CopyId, Removed
  165.     IF EditId NE 0 THEN UpdateCut, EditId, Removed
  166.  
  167.     ;   Paste dialog is unique.  Special update code required.
  168.  
  169.     IF PasteId NE 0 THEN BEGIN      ; Do we even have a paste dialog visible?
  170.  
  171.         WIDGET_CONTROL, PasteId, GET_UVALUE=Binfo, /NO_COPY
  172.  
  173.         ;   Has a parent widget been removed?
  174.  
  175.         OldList         = Binfo.Ptrs
  176.         TreeDisturbed   = WHERE(Binfo.Parents EQ Removed, Count)
  177.         IF Count NE 0 THEN BEGIN
  178.             Binfo.Parents   = TopPtr
  179.             NewTop          = TopPtr
  180.         ENDIF ELSE BEGIN
  181.             NewTop          = Binfo.Parents
  182.             NewTop          = NewTop[0]
  183.         ENDELSE
  184.  
  185.         MakeLists, NewTop, List, Strs   ; Make list to reflect (possibly)
  186.                                         ; new current parent
  187.  
  188.         ;   Paste list has an additional fake entry. the Top-Of-List.
  189.  
  190.         IF List[0] EQ 0 THEN BEGIN
  191.             List    = -1L
  192.             Strs    = '<Top of List>'
  193.         ENDIF ELSE BEGIN
  194.             List    = [ -1L, List]
  195.             Strs    = [ '<Top of List>', Strs ]
  196.         ENDELSE
  197.  
  198.         ;   See if the list remains undisturbed
  199.  
  200.         IF N_ELEMENTS(OldList) EQ N_ELEMENTS(List) THEN BEGIN
  201.             Dummy   = WHERE(OldList NE List, Count)
  202.             IF Count EQ 0 THEN GOTO, FixCutList
  203.         ENDIF
  204.  
  205.         ;   Rebuild Dialog info to reflect new child list.
  206.         ;   Note: the from list is built on the fly and not
  207.         ;   reflected in the dialog information structure
  208.  
  209.         Binfo   = {                     $
  210.             Ptrs:List,                  $
  211.             Parents:Binfo.Parents,      $
  212.             FromIdx:Binfo.FromIdx,      $
  213.             ToIdx:0,                    $
  214.             FromListId:Binfo.FromListId,$
  215.             LabelId:Binfo.LabelId,      $
  216.             ToListId:Binfo.ToListId,    $
  217.             PasteBtn:Binfo.PasteBtn,    $
  218.             ChildBtn:Binfo.ChildBtn,    $
  219.             ParentBtn:Binfo.ParentBtn   $
  220.         }
  221.  
  222.         ;   Set controls
  223.  
  224.         WIDGET_CONTROL, Binfo.LabelId, SET_VALUE='Children of '+VarId(NewTop)
  225.         WIDGET_CONTROL, Binfo.ToListId, SET_VALUE=Strs
  226.         WIDGET_CONTROL, Binfo.ToListId, SET_LIST_SELECT=0
  227.         WIDGET_CONTROL, Binfo.ParentBtn, SENSITIVE=(NewTop NE TopPtr)
  228.  
  229.     FixCutList:
  230.         ;   If we jumped here, something has changed but it is
  231.         ;   outside of the visible list.  This can however, affect
  232.         ;   the 'show children' action.
  233.  
  234.         WIDGET_CONTROL, Binfo.ChildBtn, $
  235.             SENSITIVE=HasChildren(List[Binfo.ToIdx], /NONE_OK)
  236.  
  237.  
  238.         ;   Rebuild the cutlist (From)
  239.  
  240.         FromStrs    = ""
  241.         Ptr         = CutList
  242.         WHILE Ptr NE 0 DO BEGIN
  243.             IdStr   = GetId(Ptr)
  244.             IF StrLen(IdStr) GT 20 THEN $
  245.                 IdStr = STRING(FORMAT='(A17,"...")', IdStr)
  246.             FromStrs    = [ FromStrs, VarId(Ptr)+' ('+IdStr+')' ]
  247.             Ptr         = NextPtr(Ptr)
  248.         ENDWHILE
  249.  
  250.         ;   Show changes
  251.         Binfo.FromIdx   = 0
  252.         WIDGET_CONTROL, Binfo.FromListId, SET_VALUE=FromStrs[1:*]
  253.         WIDGET_CONTROL, Binfo.FromListId, SET_LIST_SELECT=0
  254.  
  255.  
  256.         ;   Save new dialog info
  257.         WIDGET_CONTROL, PasteId, SET_UVALUE=Binfo, /NO_COPY
  258.     ENDIF
  259. END
  260.  
  261.  
  262. ;
  263. ;  MakeLists
  264. ;   Common routine that given a pointer to a base object, creates
  265. ;   2 parallel arrays:  One with the pointers to its children and the
  266. ;   other with a name list for the same children.
  267. ;
  268. ;   List            Strs
  269. ;   12              LABEL12 (Press Me)
  270. ;
  271. PRO MakeLists, ParPtr, List, Strs
  272.  
  273.   COMMON WidEd_Comm
  274.  
  275.     Ptr2Obj, ParPtr, Obj
  276.  
  277.     ; Dependent bases are considered to be children of the MAIN object
  278.  
  279.     List    = 0L            ; Start lists
  280.     Strs    = ""
  281.  
  282.     ;   Add true children first
  283.  
  284.     Ptr     = Obj.Children
  285.     WHILE Ptr NE 0 DO BEGIN
  286.         List    = [ List, Ptr]
  287.         IdStr   = GetId(Ptr)
  288.         IF StrLen(IdStr) GT 20 THEN $
  289.             IdStr = STRING(FORMAT='(A17,"...")', IdStr)
  290.         Strs    = [ Strs, VarId(Ptr)+' ('+IdStr+')' ]
  291.         Ptr     = NextPtr(Ptr)
  292.     ENDWHILE
  293.  
  294.     ;   If this is the MAIN base, add dependent bases to the list
  295.  
  296.     IF ParPtr EQ TopPtr THEN BEGIN
  297.         Ptr     = Obj.Next
  298.         WHILE Ptr NE 0 DO BEGIN
  299.             List    = [ List, Ptr ]
  300.             IdStr   = GetId(Ptr)
  301.             IF StrLen(IdStr) GT 20 THEN $
  302.                 IdStr = STRING(FORMAT='(A17,"...")', IdStr)
  303.             Strs    = [ Strs, VarId(Ptr)+' ('+IdStr+')' ]
  304.             Ptr     = NextPtr(Ptr)
  305.         ENDWHILE
  306.     ENDIF
  307.  
  308.     ;   If we have at least one child, remove the fake entry used
  309.     ;   to start the list.  Otherwise return the fake entry to
  310.     ;   indicate that there are no children
  311.  
  312.     IF N_ELEMENTS(List) GT 1 THEN BEGIN
  313.         List    = List[1:*]
  314.         Strs    = Strs[1:*]
  315.     ENDIF
  316.  
  317.     Obj2Ptr, Obj, ParPtr        ; Restore parent information
  318. END
  319.  
  320.  
  321. ;
  322. ;  RemoveDialogs
  323. ;   Close any active dialog box associated with the given portion
  324. ;   of the object tree.
  325. ;   Note: Base objects have 2 possible dialog boxes.
  326. ;
  327. PRO RemoveDialogs, Ptr
  328.  
  329.     Ptr2Obj, Ptr, Obj
  330.  
  331.     ;   If we have an active dialog box, destroy it
  332.  
  333.     IF WIDGET_INFO(Obj.Dialog, /VALID_ID) THEN BEGIN
  334.         WIDGET_CONTROL, Obj.Dialog, /DESTROY
  335.         Obj.Dialog  = 0L
  336.     ENDIF
  337.  
  338.     ;   If we are a base object, see if we have an aux dialog box
  339.     ;   and destroy it and destroy our children's dialog boxes as well
  340.  
  341.     IF TAG_NAMES(Obj, /STRUCTURE) EQ 'WE_BASE' THEN BEGIN
  342.         IF WIDGET_INFO(Obj.AttrDlg, /VALID_ID) THEN BEGIN
  343.             WIDGET_CONTROL, Obj.AttrDlg, /DESTROY
  344.             Obj.AttrDlg = 0L
  345.         ENDIF
  346.         DoList, Obj.Children, "RemoveDialogs"
  347.     ENDIF
  348.  
  349.     Obj2Ptr, Obj, Ptr
  350. END
  351.  
  352.  
  353. ;
  354. ;  CutEvent
  355. ;   Handle events for the cut/copy/edit dialogs.  Naming is historical
  356. ;
  357. PRO CutEvent, Event
  358.  
  359.   COMMON WidEd_Comm
  360.  
  361.     WIDGET_CONTROL, Event.Id, GET_UVALUE=Ev         ; Get Event
  362.     WIDGET_CONTROL, Event.Top, GET_UVALUE=Binfo     ; Get Dialog info
  363.  
  364.     CASE Ev OF
  365.  
  366.     'LIST': BEGIN
  367.         ;   Get new current selection
  368.         Idxs            = Binfo.Ptrs
  369.         Child           = Idxs[Event.Index]
  370.         Binfo.ListIdx   = Event.Index
  371.  
  372.         WIDGET_CONTROL, Event.Top, SET_UVALUE=Binfo
  373.  
  374.         ;   Cannot cut or copy a Dependent base
  375.         IF Event.Top EQ CutId OR Event.Top EQ CopyId THEN BEGIN
  376.             GetType, Child, Type
  377.             WIDGET_CONTROL, Binfo.ActionBtn, SENSITIVE=(Type NE "DEP")
  378.         ENDIF
  379.  
  380.         ;   Can only look at the children of something that has children
  381.         WIDGET_CONTROL, Binfo.ChildBtn, SENSITIVE=HasChildren(Child)
  382.         END
  383.  
  384.     'Cut':  BEGIN
  385.         Dirty       = 1
  386.         Ptrs        = Binfo.Ptrs
  387.         ChildPtr    = Ptrs[Binfo.ListIdx]
  388.         Ptr2Obj, ChildPtr, Child            ; Get Child Info
  389.  
  390.         Parents     = Binfo.Parents
  391.         ParentPtr   = Parents[0]
  392.         Ptr2Obj, ParentPtr, Parent          ; Get Parent Info
  393.  
  394.         ;   First child?
  395.         IF Binfo.ListIdx EQ 0 THEN BEGIN
  396.             Parent.Children = Child.Next
  397.  
  398.             ;   Parent now has no children?
  399.             IF Parent.Children EQ 0 THEN Parent.LastChild = 0
  400.         ENDIF ELSE BEGIN
  401.             PrevPtr = Ptrs[Binfo.ListIdx-1]     ; Get PrevPtr from list
  402.             SetTag, PrevPtr, "Next", Child.Next ; Remove child from list
  403.  
  404.             ;   Was child lastchild of base?  Set LastChild to show change.
  405.             IF Child.Next EQ 0 THEN Parent.LastChild = PrevPtr
  406.         ENDELSE
  407.  
  408.         Child.Next  = CutList           ; Child goes onto cut list
  409.         CutList     = ChildPtr
  410.         Obj2Ptr, Child, ChildPtr        ; Save new child info
  411.         Obj2Ptr, Parent, ParentPtr      ; Save new parent info
  412.  
  413.         RemoveDialogs, ChildPtr         ; Remove active dialog for child tree
  414.  
  415.         Count   = 1                     ; Cutlist has 10 objects at most
  416.         Ptr     = CutList
  417.         WHILE Ptr NE 0 AND Count LE 10 DO BEGIN
  418.             Prev    = Ptr
  419.             Ptr     = NextPtr(Ptr)
  420.             Count   = Count + 1
  421.         ENDWHILE
  422.  
  423.         IF Ptr NE 0 THEN BEGIN
  424.             SetTag, Ptr, "Dialog", 0L   ; Don't destroy dialog box
  425.             Destroy, Ptr                ; Destroy 11th item
  426.             SetTag, Prev, "Next", 0L    ; Remove Destroyed item from CutList
  427.         ENDIF
  428.         UpDateEdit, ChildPtr            ; Show changes in cut/copy/paste
  429.         ; We could have destroyed ourselves if we have deleted
  430.         ; the last widget in the hierarchy
  431.         IF CutId NE 0 THEN WIDGET_CONTROL, Binfo.PasteBtn, SENSITIVE=1
  432.         IF CopyId NE 0 THEN BEGIN
  433.             Ptr2Obj, CopyId, CopyInfo
  434.             WIDGET_CONTROL, CopyInfo.PasteBtn, SENSITIVE=1
  435.             Obj2Ptr, CopyInfo, CopyId
  436.         ENDIF
  437.  
  438.         END
  439.  
  440.     'Copy': BEGIN
  441.         Ptrs        = Binfo.Ptrs        ; Get Child pointer and type
  442.         ChildPtr    = Ptrs[Binfo.ListIdx]
  443.         GetType, ChildPtr, Type
  444.  
  445.         CALL_PROCEDURE, Type+"_Copy", ChildPtr, Copy    ; Copy it
  446.  
  447.         SetTag, Copy, "Next", CutList       ; Add copy to cut list
  448.         CutList     = Copy
  449.  
  450.         Count       = 1                 ; Cutlist has 10 objects at most
  451.         Ptr         = CutList
  452.         WHILE Ptr NE 0 AND Count LE 10 DO BEGIN
  453.             Prev    = Ptr
  454.             Ptr     = NextPtr(Ptr)
  455.             Count   = Count + 1
  456.         ENDWHILE
  457.  
  458.         IF Ptr NE 0 THEN BEGIN
  459.             SetTag, Ptr, "Dialog", 0L   ; Don't destroy dialog box
  460.             Destroy, Ptr                ; Destroy 11th item
  461.             SetTag, Prev, "Next", 0L    ; Remove Destroyed item from CutList
  462.         ENDIF
  463.  
  464.         UpDateEdit                      ; Show changes
  465.         WIDGET_CONTROL, Binfo.PasteBtn, SENSITIVE=1
  466.         IF CutId NE 0 THEN BEGIN
  467.             Ptr2Obj, CutId, CutInfo
  468.             WIDGET_CONTROL, CutInfo.PasteBtn, SENSITIVE=1
  469.             Obj2Ptr, CutInfo, CutId
  470.         ENDIF
  471.  
  472.         END
  473.  
  474.     'EDIT': BEGIN
  475.         Ptrs        = Binfo.Ptrs        ; Get child pointer
  476.         ChildPtr    = Ptrs[Binfo.ListIdx]
  477.  
  478.         Parents     = Binfo.Parents     ; Get parent pointer
  479.         ParentPtr   = Parents[0]
  480.  
  481.         GetType, ChildPtr, Type         ; Get child type
  482.  
  483.         ;   Dependent bases are a special case (unfortunately)
  484.         ;   but take the same NUMBER of ARGUMENTS.
  485.         ;   ParentPtr gets set to WIDGET_BASE for the dialog --
  486.         ;   a fact we can ignore.  Just be aware.
  487.  
  488.         CALL_PROCEDURE, Type+"_Build", ChildPtr, ParentPtr
  489.  
  490.         ;   If the object being editted is not a base class object
  491.         ;   then we can 'Cancel' it.  That is restore it to a previous
  492.         ;   state.  Here is where we take care of that.  Take a snapshot
  493.         ;   of the current state of the object (copy it) and store
  494.         ;   that information in the active dialog list (NewDialogs)
  495.         ;
  496.         IF Type NE 'BASE' AND Type NE 'DEP' THEN BEGIN
  497.             CALL_PROCEDURE, Type+"_Copy", ChildPtr, Copy
  498.  
  499.             ;   If we already have dialog in active list (just
  500.             ;   popping it forward) then don't add it to the list
  501.  
  502.             Dummy       = WHERE(NewDialogs.ObjPtr EQ ChildPtr, Count)
  503.             IF Count EQ 0 THEN BEGIN
  504.                 Active  = { WE_NEWOBJ, ParentPtr, ChildPtr, Copy }
  505.                 NewDialogs      = [ NewDialogs, Active ]
  506.             ENDIF
  507.         ENDIF
  508.         END
  509.  
  510.     'CHILD':    BEGIN
  511.         Ptrs        = Binfo.Ptrs            ; Get current pointer
  512.         NewTop      = Ptrs[Binfo.ListIdx]
  513.         Parents     = [ NewTop, Binfo.Parents ] ; Now its the current parent
  514.  
  515.         MakeLists, Parents[0], List, Strs       ; Make new list
  516.  
  517.         Binfo   = {                     $       ; Update dialog info
  518.             Ptrs:List,                  $
  519.             Parents:Parents,            $
  520.             LabelId:Binfo.LabelId,      $
  521.             ListId:Binfo.ListId,        $
  522.             ListIdx:0,                  $
  523.             ActionBtn:Binfo.ActionBtn,  $
  524.             PasteBtn:Binfo.PasteBtn,    $
  525.             ChildBtn:Binfo.ChildBtn,    $
  526.             ParentBtn:Binfo.ParentBtn   $
  527.         }
  528.  
  529.         ;   Set controls to reflect change
  530.  
  531.         WIDGET_CONTROL, Binfo.LabelId, SET_VALUE='Children of '+VarId(NewTop)
  532.         WIDGET_CONTROL, Binfo.ListId, SET_VALUE=Strs
  533.         WIDGET_CONTROL, Binfo.ListId, SET_LIST_SELECT=0
  534.  
  535.         Child   = List[0]           ; Get type of current (first) child
  536.         GetType, Child, Type
  537.  
  538.         WIDGET_CONTROL, Binfo.ActionBtn, SENSITIVE=(Type NE "DEP")
  539.         WIDGET_CONTROL, Binfo.ChildBtn, SENSITIVE=HasChildren(Child)
  540.         WIDGET_CONTROL, Binfo.ParentBtn, SENSITIVE=1    ; Alway can go ..
  541.         WIDGET_CONTROL, Event.Top, SET_UVALUE=Binfo, /NO_COPY
  542.         END
  543.  
  544.     'PARENT':   BEGIN
  545.         Parents     = Binfo.Parents[1:*]    ; New Parent list
  546.         NewTop      = Parents[0]            ; New Top
  547.         MakeLists, NewTop, List, Strs       ; New list of children
  548.  
  549.         Binfo   = {                     $   ; Update Dialog info
  550.             Ptrs:List,                  $
  551.             Parents:Parents,            $
  552.             LabelId:Binfo.LabelId,      $
  553.             ListId:Binfo.ListId,        $
  554.             ListIdx:0,                  $
  555.             ActionBtn:Binfo.ActionBtn,  $
  556.             PasteBtn:Binfo.PasteBtn,    $
  557.             ChildBtn:Binfo.ChildBtn,    $
  558.             ParentBtn:Binfo.ParentBtn   $
  559.         }
  560.  
  561.         ;   Set controls to reflect new list
  562.  
  563.         WIDGET_CONTROL, Binfo.LabelId, SET_VALUE='Children of '+VarId(NewTop)
  564.         WIDGET_CONTROL, Binfo.ListId, SET_VALUE=Strs
  565.         WIDGET_CONTROL, Binfo.ListId, SET_LIST_SELECT=0
  566.  
  567.         ;   Can't cut or copy a DEP base.
  568.         Child   = List[0]
  569.         IF Event.Top EQ CutId OR Event.Top EQ CopyId THEN BEGIN
  570.             GetType, Child, Type
  571.             WIDGET_CONTROL, Binfo.ActionBtn, SENSITIVE=(Type NE "DEP")
  572.         ENDIF
  573.         WIDGET_CONTROL, Binfo.ChildBtn, SENSITIVE=HasChildren(Child)
  574.         WIDGET_CONTROL, Binfo.ParentBtn, SENSITIVE=(NewTop NE TopPtr)
  575.         WIDGET_CONTROL, Event.Top, SET_UVALUE=Binfo, /NO_COPY
  576.         END
  577.  
  578.     'DOPASTE':  PasteChild
  579.  
  580.     'DONE':     WIDGET_CONTROL, Event.top, /DESTROY
  581.  
  582.     ENDCASE
  583. END
  584.  
  585. ;
  586. ;  CutChild
  587. ;   Bring up Dialog box to allow user to look through
  588. ;   existing objects for the one they want to cut/copy
  589. ;
  590. PRO CutChild, COPY=Copy
  591.  
  592.   COMMON WidEd_Comm
  593.  
  594.     ;   Which kind of dialog are we anyway?
  595.     IF KEYWORD_SET(Copy) THEN Action='Copy' ELSE Action='Cut'
  596.  
  597.     MgrName = 'Wid' + Action + 'Top'            ; Already up?
  598.     IF XRegistered(MgrName) THEN RETURN
  599.  
  600.     Title   = Action + ' Widget'
  601.     Ptr2Obj, TopPtr, Obj
  602.     IF Obj.Children EQ 0 AND Obj.Next EQ 0 THEN BEGIN
  603.         ErrorDialog, TopDlg, ['Internal Error: ', $
  604.             'There are no child widgets to ' + Action ]
  605.         RETURN
  606.     ENDIF
  607.     Obj2Ptr, Obj, TopPtr
  608.  
  609.     ;   Start by using the top level base
  610.  
  611.     MakeLists, TopPtr, List, Strs
  612.  
  613.     ;   Build Dialog
  614.  
  615.     BaseId      = WIDGET_BASE(GROUP_LEADER=TopDlg, /COLUMN, TITLE=Title)
  616.     LabelId     = WIDGET_LABEL(BaseId, VALUE='Children of ' + VarId(TopPtr))
  617.     ListId      = WIDGET_LIST(BaseId, VALUE=Strs, YSIZE=10,UVALUE='LIST')
  618.     ActionBtn   = WIDGET_BUTTON(BaseId, VALUE=Action +' Child', UVALUE=Action)
  619.     ChildBtn    = WIDGET_BUTTON(BaseId, VALUE='Show Children', UVALUE='CHILD')
  620.  
  621.     Child   = List[0]       ; Can't cut/copy a DEP base
  622.     GetType, Child, Type
  623.     WIDGET_CONTROL, ActionBtn, SENSITIVE=(Type NE "DEP")
  624.     WIDGET_CONTROL, ChildBtn, SENSITIVE=HasChildren(Child)
  625.  
  626.     ;   Top Base has no parent.  Create the button but disable it.
  627.     ParentBtn   = WIDGET_BUTTON(BaseId, VALUE='Show Parent Base', $
  628.             UVALUE='PARENT')
  629.     WIDGET_CONTROL, ParentBtn, SENSITIVE=0
  630.  
  631.     PasteBtn    = WIDGET_BUTTON(BaseId, VALUE='Show Paste Dialog', $
  632.                                 UVALUE='DOPASTE')
  633.     WIDGET_CONTROL, PasteBtn, SENSITIVE=(CutList NE 0L)
  634.  
  635.     Button      = WIDGET_BUTTON(BaseId, VALUE='Done', UVALUE='DONE')
  636.  
  637.     Binfo   = {                 $
  638.         Ptrs:List,              $
  639.         Parents: TopPtr,        $
  640.         LabelId: LabelId,       $
  641.         ListId: ListId,         $
  642.         ListIdx: 0,             $
  643.         ActionBtn: ActionBtn,   $
  644.         PasteBtn: PasteBtn,     $
  645.         ChildBtn: ChildBtn,     $
  646.         ParentBtn: ParentBtn    $
  647.     }
  648.     WIDGET_CONTROL, BaseId, /REALIZE
  649.     WIDGET_CONTROL, ListId, SET_LIST_SELECT=0
  650.     WIDGET_CONTROL, BaseId, SET_UVALUE=Binfo, /NO_COPY
  651.     XMANAGER, MgrName, BaseId, EVENT_HANDLER='CutEvent',CLEANUP='KillEdit'
  652.     IF KEYWORD_SET(Copy) THEN CopyId = BaseId ELSE CutId = BaseId
  653. END
  654.  
  655.  
  656. ;
  657. ;  EditChild
  658. ;   Allow user to get to dialog boxes they have dismissed previously.
  659. ;
  660. PRO EditChild
  661.  
  662.   COMMON WidEd_Comm
  663.  
  664.     MgrName = 'WidEditTop'
  665.     IF XRegistered(MgrName) THEN RETURN             ; Already up?
  666.  
  667.     Title   = 'Edit Widget'
  668.     Ptr2Obj, TopPtr, Obj
  669.     IF Obj.Children EQ 0 AND Obj.Next EQ 0 THEN BEGIN
  670.         ErrorDialog, TopDlg, ['Internal Error: ', $
  671.             'There are no child widgets to Edit' ]
  672.         RETURN
  673.     ENDIF
  674.     Obj2Ptr, Obj, TopPtr
  675.  
  676.     ;   Start by showing the top level children.
  677.  
  678.     MakeLists, TopPtr, List, Strs
  679.  
  680.     ;   Build Dialog
  681.  
  682.     EditId  = WIDGET_BASE(GROUP_LEADER=TopDlg, /COLUMN, TITLE=Title)
  683.     LabelId = WIDGET_LABEL(EditId, VALUE='Children of '+ VarId(TopPtr))
  684.     ListId  = WIDGET_LIST(EditId, VALUE=Strs, YSIZE=10, UVALUE='LIST')
  685.     EditBtn = WIDGET_BUTTON(EditId, VALUE='Edit Child', UVALUE='EDIT')
  686.     ChildBtn    = WIDGET_BUTTON(EditId, VALUE='Show Children', UVALUE='CHILD')
  687.     WIDGET_CONTROL, ChildBtn, SENSITIVE=HasChildren(List[0])
  688.     ParentBtn   = WIDGET_BUTTON(EditId, VALUE='Show Parent Base', $
  689.             UVALUE='PARENT')
  690.     WIDGET_CONTROL, ParentBtn, SENSITIVE=0
  691.     Button  = WIDGET_BUTTON(EditId, VALUE='Done', UVALUE='DONE')
  692.  
  693.     ;   We don't really use the ActionBtn or PasteBtn fields but we
  694.     ;   need to have them so that the dialog information is identical
  695.     ;   to that used by Cut/Copy dialogs (all 3 share a common event handler)
  696.  
  697.     Binfo   = {             $
  698.         Ptrs:List,          $
  699.         Parents: TopPtr,    $
  700.         LabelId:LabelId,    $
  701.         ListId:ListId,      $
  702.         ListIdx:0,          $
  703.         ActionBtn:EditBtn,  $
  704.         PasteBtn:0L,        $
  705.         ChildBtn:ChildBtn,  $
  706.         ParentBtn:ParentBtn $
  707.     }
  708.     WIDGET_CONTROL, EditId, /REALIZE
  709.  
  710.     WIDGET_CONTROL, ListId, SET_LIST_SELECT=0
  711.     WIDGET_CONTROL, EditId, SET_UVALUE=Binfo, /NO_COPY
  712.     XMANAGER, MgrName, EditId,  $
  713.         EVENT_HANDLER='CutEvent',CLEANUP='KillEdit'
  714. END
  715.  
  716.  
  717. ;
  718. ;  PasteChildEvent
  719. ;   Event handler for the Paste dialog.
  720. ;
  721. PRO PasteChildEvent, Event
  722.   COMMON WidEd_Comm
  723.  
  724.     WIDGET_CONTROL, Event.Id, GET_UVALUE=Ev         ; Get Event
  725.     WIDGET_CONTROL, Event.Top, GET_UVALUE=Binfo     ; Get Dialog Info
  726.  
  727.     CASE Ev OF
  728.  
  729.     'CUTLIST':  BEGIN
  730.         Binfo.FromIdx   = Event.Index                   ; Set Currnt From Idx
  731.         WIDGET_CONTROL, Event.Top, SET_UVALUE=Binfo
  732.         END
  733.  
  734.     'PASTELIST':    BEGIN
  735.         Idxs            = Binfo.Ptrs
  736.         Child           = Idxs[Event.Index]
  737.         Binfo.ToIdx     = Event.Index
  738.  
  739.         IF Child EQ -1L THEN Type = ';BOGUS' $         ; <Top of List> ?
  740.         ELSE GetType, Child, Type                       ; Regular selection
  741.  
  742.         ;   Cant paste after a dependent base
  743.         WIDGET_CONTROL, Binfo.PasteBtn, SENSITIVE=(Type NE 'DEP')
  744.         ;   Can look in a base which has no children
  745.         WIDGET_CONTROL, Binfo.ChildBtn, SENSITIVE=HasChildren(Child,/NONE_OK)
  746.  
  747.         WIDGET_CONTROL, Event.Top, SET_UVALUE=Binfo     ; Update Dialog info
  748.         END
  749.  
  750.     'PASTE':    BEGIN
  751.         Ptrs        = Binfo.Ptrs            ; Get Parent pointer
  752.         Parents     = Binfo.Parents
  753.         ParentPtr   = Parents[0]
  754.         ChildPtr    = Ptrs[Binfo.ToIdx]     ; Get child pointer
  755.  
  756.         Ptr         = CutList               ; Given From List index
  757.         Count       = Binfo.FromIdx         ; figure out the current
  758.         WHILE Count NE 0 DO BEGIN           ; item to paste
  759.             Ptr     = NextPtr(Ptr)
  760.             Count   = Count - 1
  761.         ENDWHILE
  762.  
  763.         GetType, Ptr, Type                  ; Copy item to paste
  764.         CALL_PROCEDURE, Type+"_Copy", Ptr, Dup
  765.         SetTag, Dup, "Id", NewId()          ; Give it a new Id.
  766.  
  767.         ;   Add into child list
  768.  
  769.         IF ChildPtr EQ -1L THEN BEGIN        ;   First child?
  770.  
  771.             Ptr2Obj, ParentPtr, PObj
  772.  
  773.             SetTag, Dup, "Next", PObj.Children
  774.             IF PObj.Children EQ 0 THEN PObj.LastChild = Dup
  775.             PObj.Children    = Dup
  776.  
  777.             Obj2Ptr, PObj, ParentPtr
  778.  
  779.         ENDIF ELSE BEGIN
  780.  
  781.             SetTag, Dup, "Next", NextPtr(ChildPtr)  ; Dup->next = prev->next
  782.             SetTag, ChildPtr, "Next", Dup           ; prev->next = dup
  783.  
  784.             ;   We keep track of last child.  If ChildPtr was the
  785.             ;   last child it isn't any longer.  Change the Parent's
  786.             ;   LastChild to reflect the addition
  787.  
  788.             Ptr2Obj, ParentPtr, PObj
  789.             IF PObj.LastChild EQ ChildPtr THEN PObj.LastChild = Dup
  790.             Obj2Ptr, PObj, ParentPtr
  791.  
  792.         ENDELSE
  793.  
  794.         UpdateEdit          ; Show changes in cut/paste/etc.
  795.         END
  796.  
  797.     'CHILD':    BEGIN
  798.         Ptrs        = Binfo.Ptrs                ; Current selection is now
  799.         NewTop      = Ptrs[Binfo.ToIdx]         ; the current parent
  800.         Parents     = [ NewTop, Binfo.Parents ]
  801.  
  802.         MakeLists, Parents[0], List, Strs
  803.  
  804.         List    = [ -1L, List]                  ; Add top-of-list item
  805.         Strs    = [ '<Top of List>', Strs ]
  806.  
  807.         Binfo   = {                     $       ; Create dialog info
  808.             Ptrs:List,                  $
  809.             Parents:Parents,            $
  810.             FromIdx:Binfo.FromIdx,      $
  811.             ToIdx:0,                    $
  812.             FromListId:Binfo.FromListId,$
  813.             LabelId:Binfo.LabelId,      $
  814.             ToListId:Binfo.ToListId,    $
  815.             PasteBtn:Binfo.PasteBtn,    $
  816.             ChildBtn:Binfo.ChildBtn,    $
  817.             ParentBtn:Binfo.ParentBtn   $
  818.         }
  819.  
  820.         ;   Set dialog controls to reflect current conditions
  821.  
  822.         WIDGET_CONTROL, Binfo.LabelId, SET_VALUE='Children of '+VarId(NewTop)
  823.         WIDGET_CONTROL, Binfo.ToListId, SET_VALUE=Strs
  824.         WIDGET_CONTROL, Binfo.ToListId, SET_LIST_SELECT=0
  825.         WIDGET_CONTROL, Binfo.ChildBtn, SENSITIVE=0
  826.         WIDGET_CONTROL, Binfo.ParentBtn, SENSITIVE=1    ; Alway can go ..
  827.         WIDGET_CONTROL, Event.Top, SET_UVALUE=Binfo, /NO_COPY
  828.         END
  829.  
  830.     'PARENT':   BEGIN
  831.         Parents     = Binfo.Parents[1:*]   ; Go toward root widget 1 level
  832.         NewTop      = Parents[0]
  833.         MakeLists, NewTop, List, Strs
  834.  
  835.         List    = [ -1L, List]                  ; Add top-of-list item
  836.         Strs    = [ '<Top of List>', Strs ]
  837.  
  838.         Binfo   = {                     $       ; Create dialog info
  839.             Ptrs:List,                  $
  840.             Parents:Parents,            $
  841.             FromIdx:Binfo.FromIdx,      $
  842.             ToIdx:0,                    $
  843.             FromListId:Binfo.FromListId,$
  844.             LabelId:Binfo.LabelId,      $
  845.             ToListId:Binfo.ToListId,    $
  846.             PasteBtn:Binfo.PasteBtn,    $
  847.             ChildBtn:Binfo.ChildBtn,    $
  848.             ParentBtn:Binfo.ParentBtn   $
  849.         }
  850.  
  851.         ;   Set dialog controls to reflect current conditions
  852.  
  853.         WIDGET_CONTROL, Binfo.LabelId, SET_VALUE='Children of '+VarId(NewTop)
  854.         WIDGET_CONTROL, Binfo.ToListId, SET_VALUE=Strs
  855.         WIDGET_CONTROL, Binfo.ToListId, SET_LIST_SELECT=0
  856.         WIDGET_CONTROL, Binfo.ChildBtn, SENSITIVE=0
  857.         WIDGET_CONTROL, Binfo.ParentBtn, SENSITIVE=(NewTop NE TopPtr)
  858.         WIDGET_CONTROL, Event.Top, SET_UVALUE=Binfo, /NO_COPY
  859.         END
  860.  
  861.     'DELETE':   BEGIN
  862.  
  863.         ;       Cutting first item on the list?
  864.  
  865.         IF Binfo.FromIdx EQ 0 THEN BEGIN
  866.  
  867.             Item        = CutList
  868.             CutList     = NextPtr(CutList)
  869.             Destroy, Item
  870.  
  871.             ;  Nothing left to paste?  We are done.
  872.  
  873.             IF CutList EQ 0 THEN BEGIN
  874.                 ; Can't paste no more
  875.  
  876.                 Ptr2Obj, TopDlg, DlgInfo
  877.                 WIDGET_CONTROL, DlgInfo.PasteId, SENSITIVE=0
  878.                 Obj2Ptr, DlgInfo, TopDlg 
  879.  
  880.                 IF CutId NE 0 THEN BEGIN
  881.                     Ptr2Obj, CutId, CutInfo
  882.                     WIDGET_CONTROL, CutInfo.PasteBtn, SENSITIVE=0
  883.                     Obj2Ptr, CutInfo, CutId
  884.                 ENDIF
  885.  
  886.                 IF CopyId NE 0 THEN BEGIN
  887.                     Ptr2Obj, CopyId, CopyInfo
  888.                     WIDGET_CONTROL, CopyInfo.PasteBtn, SENSITIVE=0
  889.                     Obj2Ptr, CopyInfo, CopyId
  890.                 ENDIF
  891.  
  892.                 WIDGET_CONTROL, Event.top, /DESTROY
  893.                 RETURN
  894.             ENDIF
  895.  
  896.         ENDIF ELSE BEGIN
  897.  
  898.             Ptr         = CutList           ; Given From List index
  899.             Count       = Binfo.FromIdx     ; figure out the current
  900.             WHILE Count NE 0 DO BEGIN       ; item to paste
  901.                 Prev    = Ptr
  902.                 Ptr     = NextPtr(Ptr)
  903.                 Count   = Count - 1
  904.             ENDWHILE
  905.  
  906.             SetTag, Prev, "Next", NextPtr(Ptr)
  907.             Destroy, Ptr
  908.  
  909.         ENDELSE
  910.  
  911.         ;   Create list entries based on Cutlist contents
  912.  
  913.         FromStrs    = ""
  914.         Ptr         = CutList
  915.         WHILE Ptr NE 0 DO BEGIN
  916.             IdStr   = GetId(Ptr)
  917.             IF StrLen(IdStr) GT 20 THEN $
  918.                 IdStr = STRING(FORMAT='(A17,"...")', IdStr)
  919.             FromStrs    = [ FromStrs, VarId(Ptr)+' ('+IdStr+')' ]
  920.             Ptr         = NextPtr(Ptr)
  921.         ENDWHILE
  922.  
  923.         ;   Update list and binfo structure
  924.  
  925.         WIDGET_CONTROL, Binfo.FromListId, SET_VALUE=FromStrs[1:*]
  926.         WIDGET_CONTROL, Binfo.FromListId, SET_LIST_SELECT=0
  927.         Binfo.FromIdx   = 0
  928.         WIDGET_CONTROL, Event.Top, SET_UVALUE=Binfo, /NO_COPY
  929.         END
  930.  
  931.     'DONE':         WIDGET_CONTROL, Event.top, /DESTROY
  932.  
  933.     ENDCASE
  934. END
  935.  
  936.  
  937. ;
  938. ;  PasteChild
  939. ;   Bring up a Dialog box to allow the user to paste(copy) objects
  940. ;   that are on the cutlist into the current widget tree.
  941. ;
  942. PRO PasteChild
  943.  
  944.   COMMON WidEd_Comm      
  945.  
  946.     MgrName = 'WidPasteTop'
  947.     IF XRegistered(MgrName) THEN RETURN         ; Already have dialog?
  948.  
  949.     Title   = 'Paste Widgets'
  950.     IF CutList EQ 0L THEN BEGIN
  951.         ErrorDialog, TopDlg, ['Internal Error: ', $
  952.             'There are no child widgets to Paste' ]
  953.         RETURN
  954.     ENDIF
  955.  
  956.     ;   Create the dialog
  957.  
  958.     PasteId = WIDGET_BASE(GROUP_LEADER=TopDlg, /COLUMN, TITLE=Title)
  959.     Base1   = WIDGET_BASE(PasteId, /ROW)
  960.     Base2   = WIDGET_BASE(Base1, /COLUMN)
  961.     Label   = WIDGET_LABEL(Base2, VALUE='Clipboard')
  962.  
  963.     ;   Create list entries based on Cutlist contents
  964.  
  965.     FromStrs    = ""
  966.     Ptr         = CutList
  967.     WHILE Ptr NE 0 DO BEGIN
  968.         IdStr   = GetId(Ptr)
  969.         IF StrLen(IdStr) GT 20 THEN $
  970.             IdStr = STRING(FORMAT='(A17,"...")', IdStr)
  971.         FromStrs    = [ FromStrs, VarId(Ptr)+' ('+IdStr+')' ]
  972.         Ptr         = NextPtr(Ptr)
  973.     ENDWHILE
  974.  
  975.     FromListId  = WIDGET_LIST(Base2, VALUE=FromStrs[1:*], YSIZE=10, $
  976.             UVALUE='CUTLIST')
  977.     Delete  = WIDGET_BUTTON(Base2, VALUE='Delete Widget', UVALUE='DELETE')
  978.     Base2   = WIDGET_BASE(Base1, /COLUMN)
  979.     LabelId = WIDGET_LABEL(Base2, VALUE='Children of '+VarId(TopPtr))
  980.  
  981.     MakeLists, TopPtr, List, Strs           ; Make list of top level children
  982.  
  983.     List    = [ -1L, List]                  ; Add top-of-list entry
  984.     Strs    = [ '<Top of List>', Strs ]
  985.  
  986.     ToListId    = WIDGET_LIST(Base2, VALUE=Strs, YSIZE=10, $
  987.             UVALUE='PASTELIST')
  988.     PasteBtn    = WIDGET_BUTTON(Base2, VALUE='Paste After', UVALUE='PASTE')
  989.     ChildBtn    = WIDGET_BUTTON(Base2, VALUE='Show Children', UVALUE='CHILD')
  990.     WIDGET_CONTROL, ChildBtn, SENSITIVE=0
  991.     ParentBtn   = WIDGET_BUTTON(Base2, VALUE='Show Parent Base', $
  992.             UVALUE='PARENT')
  993.     WIDGET_CONTROL, ParentBtn, SENSITIVE=0
  994.     Button  = WIDGET_BUTTON(PasteId, VALUE='Done', UVALUE='DONE')
  995.  
  996.     Binfo   = {                 $               ; Create Dialog info
  997.         Ptrs:List,              $
  998.         Parents: TopPtr,        $
  999.         FromIdx:0,              $
  1000.         ToIdx:0,                $
  1001.         FromListId:FromListId,  $
  1002.         LabelId:LabelId,        $
  1003.         ToListId:ToListId,      $
  1004.         PasteBtn:PasteBtn,      $
  1005.         ChildBtn:ChildBtn,      $
  1006.         ParentBtn:ParentBtn     $
  1007.     }
  1008.     WIDGET_CONTROL, PasteId, /REALIZE
  1009.     WIDGET_CONTROL, FromListId, SET_LIST_SELECT=0   ; Select item 0 of from
  1010.     WIDGET_CONTROL, ToListId, SET_LIST_SELECT=0     ; Select item 0 of to
  1011.  
  1012.     ;   Note:  We know that we can always paste the 1st cutlist item
  1013.     ;   after the top-of-list item.  Thats why we don't play with
  1014.     ;   PasteBtn sensitivity here
  1015.  
  1016.     WIDGET_CONTROL, PasteId, SET_UVALUE=Binfo, /NO_COPY
  1017.     XMANAGER, MgrName, PasteId, $
  1018.         EVENT_HANDLER='PasteChildEvent',CLEANUP='KillEdit'
  1019. END
  1020.  
  1021.  
  1022. ;
  1023. ;  KillEdit
  1024. ;   Common kill routine for all cut/paste/etc. dialogs.  Reset common
  1025. ;   block id for the appropriate dialog to show dialog has been destroyed.
  1026. ;
  1027. PRO KillEdit, Id
  1028.  
  1029.   COMMON WidEd_Comm      
  1030.  
  1031.     IF Id EQ CutId THEN CutId = 0L
  1032.     IF Id EQ CopyId THEN CopyId = 0L
  1033.     IF Id EQ PasteId THEN PasteId = 0L
  1034.     IF Id EQ EditId THEN EditId = 0L
  1035. END
  1036.  
  1037. PRO WidEdit
  1038. END
  1039.